{* 
Change logs
- Juen 6, 2011 - support google map
*}

<div class="contactmodule default">
	{if $moduletitle != ""}<h1>{$moduletitle}</h1>{/if}
	{if $numContacts != 0}
	<div>
		{* Key for nhadattudo.com: ABQIAAAAIcqPJIx6PjH8G4pSV4j5iBRTx3s-oajZj2GMFrZJxQvQLSuDNRRQ2sCQz0iJQ-WrcYFb10cx5DW3iQ\
			huybds: ABQIAAAAIcqPJIx6PjH8G4pSV4j5iBRmVfEavrihJnUbuRuq9OpKk9YUpRSv97D2DsmdusJw9PZ2OllBlgKXNA
		*}
		{if $conf->show_map == 1}
			 <script src="http://maps.google.com/maps?file=api&amp;v=3&amp;sensor=false&amp;key={$conf->googlemap_key}" type="text/javascript"></script>
			 <div id="map_{$__loc->src}" class="contactmodule_map"></div>
			 {literal}
			 <script language="javascript">
				function _ab_buildmap(){
					if (GBrowserIsCompatible()) {
						var map = new GMap2(document.getElementById('{/literal}map_{$__loc->src}'));
						var glat=new GLatLng({$conf->longt}, {$conf->lat});
						var marker = new GMarker(glat);
						var html = "{$conf->location_des}";
						map.setCenter(glat, {$conf->map_zoom});
						map.addControl(new GSmallMapControl());
						map.addOverlay(marker);
						marker.openInfoWindowHtml(html);
						{literal}
					}
				}
				jQuery(document).ready(function(){
					setTimeout("_ab_buildmap();",500);
				});
			 </script>
			 {/literal}
		{else}
			{if $conf->show_map == 2}
				<div id="map_{$__loc->src}" class="contactmodule_map">{$conf->location_des}</div>                    
			   {else}
				<img src="{$smarty.const.THEME_RELATIVE}modules/contactmodule/images/bible.jpg" border=0 align=right style="margin-right: 40px;">
			{/if}
		{/if}
	
		{form name=contact action=contact}
			{control type=hidden name=msg value="_Default"}
			<table border = 0>
				<tr>
					<td style="padding-right: 15px;"><div id="nameControl" class="text control "><label><span class="label">{$_TR.gender}</span></label></div></td>
					<td><div id="nameControl" class="text control "><label><span class="label">{$_TR.first_name}</span></label></div></td>
					<td><div id="nameControl" class="text control "><label><span class="label">{$_TR.last_name}</span></label></div></td>
				</tr>
				<tr>
					<td style="vertical-align: top;">
						<span class="control">
						<select name="gender" class="text control">
							<option value="{$_TR.mr}" selected>{$_TR.mr}</option>
							<option value="{$_TR.ms}">{$_TR.ms}</option>
							<option value="{$_TR.mrs}">{$_TR.mrs}</option>
							<option value="" selected>{$_TR.gender_not_available}</option>
						</select>
						</span>
					</td>
					<td style="vertical-align: top;">
						<span class="control">
						<input type=text size=7 class="control text required" name="first_name" style="width:85px !important;">
						</td>
					<td style="vertical-align: top;">
						<span class="control">
						<input type=text size=12 class="text required " name="last_name" style="width: 85px;">
						</span>
						</td>
				</tr>
			</table>
			
			{control type=text name=email label=$_TR.email size=42 required=1 class="required email"}
			{control type=text name=subject label=$_TR.subject size=42 required=1 class="required"}
			{control type=textarea name=message rows="5" cols="34" label=$_TR.message id="contact_textarea"}
			{if $conf->use_captcha != 0}{control type=captcha size=38 }{/if}
			<div class="control" align="center">
				<span id="contact_waiting"></span>&nbsp;<input type="submit" class="login_button" id="contact_button" value="{$_TR.send}">
			</div>
		{/form}
		{* Because, we dont build form in normal way, we must call javascript validate*}
{literal}
<script language='javascript'>
	jQuery(document).ready(function(){
		jQuery("#contact_textareaControl > label > textarea").addClass("required");
		jQuery("#captcha_stringControl > label > input").addClass("required");
		jQuery('#contact').validate();
		
		jQuery("#contact_button").click(function(){
			if (jQuery('#contact').valid())
			{
				ajax_loader_show(jQuery("#contact_waiting"));
				jQuery(this).attr("disabled", "disabled").hide();
				jQuery(this).parents("form").submit();
			}
			else
			{
				jQuery("#contact_waiting").html("");
				jQuery(this).removeAttr("disabled").show();
			}
		});
	});
</script>
{/literal}
	  </div>
	{else}
		{if $smarty.const.PREVIEW_READONLY == 1 || $permissions.configure == 1}
			{$_TR.no_contacts}<br>
		{/if}
	{/if}

	{permissions level=$smarty.const.UILEVEL_NORMAL}
		{if $permissions.configure == 1}
			<a href="{link action=manage_contacts}">{$_TR.manage_contacts}</a>
		{/if}
	{/permissions}
</div>